<template>
  <div>
    <detail-banner :detailBannerData="detailBannerData"></detail-banner>
    <detail-header></detail-header>
    <detail-list :list="detailList"></detail-list>
  </div>
</template>

<script>
import DetailBanner from './components/Banner'
import DetailHeader from './components/Header'
import DetailList from './components/List'

export default {
  name: 'Detail',
  components: {
    DetailBanner,
    DetailHeader,
    DetailList
  },
  data () {
    return {
      detailList: [],
      detailBannerData: {}
    }
  },
  methods: {
    getDetalInfo () {
      const paramId = this.$route.params.id
      const url = `/api/msdk/proxy/query_detail?id=${paramId}`
      this.$api
        .mockdata(url)
        .then(res => {
          if (res.status && res.status === 200) {
            this.detailList = res.data.DetailListData.detailList
            this.detailBannerData = res.data.DetailBannerData
          }
        })
        .catch(e => {
          console.warn(e)
        })
    }
  },
  activated: function () {
    this.getDetalInfo()
  }
}
</script>

<style lang="stylus" scoped></style>
